function validateForm(){
	var oForm=document.forms["account"];
	var oUsername=oForm["Name"];
	var oTelephone=oForm["phone"];
	var oEmail=oForm["email"];
	var oPassword=oForm["loginPwd"];
	var oPassword2=oForm["password2"];
	var oAddress=oForm["address"];
	//电话号码的正则表达式
	var reTel=/(\d{11})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1}))$/;
	//电子邮箱的正则表达式
	var reEmail=/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$/;
	
	//姓名未填
	if (oUsername.value==""){
		oUsername.parentNode.getElementsByTagName("p")[0].style.display="block";
		oUsername.focus();
		return false;
	}
	else
		oUsername.parentNode.getElementsByTagName("p")[0].style.display="none";
	
	if (oAddress.value==""){
		oAddress.parentNode.getElementsByTagName("p")[0].style.display="block";
		oAddress.focus();
		return false;
	}
	else
		oAddress.parentNode.getElementsByTagName("p")[0].style.display="none";
		
	//电话号码未填
	if (oTelephone.value==""){
		oTelephone.parentNode.getElementsByTagName("p")[0].style.display="block";		
		oTelephone.focus();
		return false;
	}//无效的电话号码
	else if (!reTel.test(oTelephone.value)){
		oTelephone.parentNode.getElementsByTagName("p")[0].style.display="none";
		oTelephone.parentNode.getElementsByTagName("p")[1].style.display="block";
		oTelephone.focus();
		return false;
	}
	else{
		oTelephone.parentNode.getElementsByTagName("p")[0].style.display="none";
		oTelephone.parentNode.getElementsByTagName("p")[1].style.display="none";
	}
	
	//电子邮箱未填
	if (oEmail.value==""){
		oEmail.parentNode.getElementsByTagName("p")[0].style.display="block";		
		oEmail.focus();
		return false;
	}//无效的电子邮箱
	else if (!reEmail.test(oEmail.value)){
		oEmail.parentNode.getElementsByTagName("p")[0].style.display="none";
		oEmail.parentNode.getElementsByTagName("p")[1].style.display="block";
		oEmail.focus();
		return false;
	}
	else{
		oEmail.parentNode.getElementsByTagName("p")[0].style.display="none";
		oEmail.parentNode.getElementsByTagName("p")[1].style.display="none";
	}
	
	//密码未填
	if (oPassword.value==""){
		oPassword.parentNode.getElementsByTagName("p")[0].style.display="block";
		oPassword.focus();
		return false;
	}
	else
		oPassword.parentNode.getElementsByTagName("p")[0].style.display="none";
		
	//确认密码未填
	if (oPassword2.value==""){
		oPassword2.parentNode.getElementsByTagName("p")[0].style.display="block";
		oPassword2.focus();
		return false;
	}
	else if (oPassword.value!=oPassword2.value){
		oPassword2.parentNode.getElementsByTagName("p")[0].style.display="none";
		oPassword2.parentNode.getElementsByTagName("p")[1].style.display="block";
		oPassword2.focus();
		return false;
	}
	else{
		oPassword2.parentNode.getElementsByTagName("p")[0].style.display="none";
		oPassword2.parentNode.getElementsByTagName("p")[1].style.display="none";
	}
	
	//性别未选择
	var oGenders=document.getElementsByName("gender");
	var bChecked=false;
	for (var i=0;i<oGenders.length;i++)
		if (oGenders[i].checked) {
			bChecked=true;
			break;
		}		
	if (!bChecked){
		oGenders[0].parentNode.parentNode.getElementsByTagName("li")[2].style.display="block";
		return false;
	}
	else
		oGenders[0].parentNode.parentNode.getElementsByTagName("li")[2].style.display="none";
}
function init(){
	document.forms["account"].onsubmit=validateForm;
}
window.onload=init;
		
	